package com.jk.service;

import com.jk.entity.Order;
import com.jk.entity.Use;
import com.jk.entity.User;
import com.jk.entity.dx;
import com.jk.mapper.UserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * Created by 动物的 on 2017/12/19.
 */
@Service("userService")
public class UserServiceImpl implements UserService{

     @Autowired
    private UserMapper userMapper;


    public String sayHello(String userName) {

        List<User> users = userMapper.selectUser();

        for (User u : users) {
            System.out.println(u);
        }
        return userName+"调用函数成功";
    }
    //登陆

    public User loginout(User user){

        return userMapper.loginout(user.getUserName());

    }
    public User shengfenzhengyancheng(User user){

        return userMapper.shengfenzhengyancheng(user.getIdCard());

    }
    //修改登录次数
    public Integer xiugaidnelucishu(String userId){
        userMapper.xiugaidnelucishu(userId);
        return 1;
    }
    //用户注册
    public Integer addzhuceh(User user){
        userMapper.addzhuceh(user);
        return 1;
    }
    //查询user表手机号
    public User shoujihaochaxun(User user){
        System.out.println(user.getPhoneNumber());
        return userMapper.shoujihaochaxun(user.getPhoneNumber());
    }
    //查询验证表手机号
    public dx chaxunhsoujihao(String shoujihao){
        return userMapper.chaxunhsoujihao(shoujihao);
    }
    //新增数据
    public Integer insertdaunxian(dx dxx){
        userMapper.insertdaunxian(dxx);
        return 1;
    }
    //修改短信次数
    public Integer updateduanxincishu(String shoujihao){
        userMapper.updateduanxincishu(shoujihao);
        return 1;
    }
    //人员树

    public List<Map> selectDeptTree() {

        return userMapper.selectDeptTree();
    }
    //人员树

    public List<Map> selectUserTreeDept() {

        return userMapper.selectUserTreeDept();
    }
    //查询应用详情
    public List<Use> yingyongxingqing(String userId){
        return userMapper.yingyongxingqing(userId);
    }
    //新增应用
    public void  addsxingzheng(Use use){
        userMapper.addsxingzheng(use);
    }
    //根据Appid 查询出来一条数据  判断秘钥对不对
    public Use panduanmiyuao(Use use){
        return userMapper.panduanmiyuao(use.getAppid());
    }
    //查询订单状态
    public Order chaxundingdianzhuangtai(String ddid){
        return userMapper.chaxundingdianzhuangtai(ddid);
    }
    //删除应用
    public Integer delectzjj(String useid){
        userMapper.delectzjj(useid);
        return 1;
    }
    //添加购买商品信息
    public Integer tianjaishangpainxianxin(Order order){

        return userMapper.tianjaishangpainxianxin(order);
    }
}
